import com.google.gson.annotations.SerializedName;

public class Position {
    @SerializedName("X")
    private double x;
    @SerializedName("Y")
    private double y;

    public Position(final double pos[]) {
	x = pos[0];
	y = pos[1];
    }

    public void setX(final double x) {
	this.x = x;
    }

    public void setY(final double y) {
	this.y = y;
    }

    public Position(final double x, final double y) {
	this.x = x;
	this.y = y;
    }

    public double getX() {
	return x;
    }

    public double getY() {
	return y;
    }

    public double getDistanceTo(final Position p) {
	return Math.sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
    }

    // bearing relative 'north'
    public double getBearingTo(final Position p) {
	return Math.atan2(p.y - y, p.x - x);
    }
}
